It is a vulgarized, simplified and better rhymed version of the saying "from the lost to the river".
When things get bad, there is always a solution